<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" >

<%@ include file="../base/taglibs.jsp" %>
<%@ page session="true"%>

<html>
	<%@ include file="../base/head.jsp" %>

	<body onload="setFocus();">
		<div id="wrap">
			<%@ include file="../snipped/header.jsp"%>
			
			<div id="content">
				
				<div style="float:left">
				<h2>Kapely</h2>
				</div>

				<div align="right">

				<form:form id="form" method="post" modelAttribute="filtrFormBean" action="filtrSubmit">	
				<table align="right">
					<tr valign="middle">
						<td><b>Filtr:</b></td>
						<td><form:input path="name" onkeyup="submitFiltrForm();" size="15" /></td>
						<td>
							<select id="bandsSelect" style="width:220px">
								<c:forEach items="${bandsFiltr}" var="row">
								<option value="${row.id}">${row.name}</option>
								</c:forEach>
							</select>
						</td>
						<td>
							<c:if test="${not empty bandsFiltr}">
								<a><img alt="Prohlížet" src="<c:url value="/resources/images/browse.png" />"
										height="18" onclick="browse()" /></a>
								<c:if test="${not empty user}">
								|
								<a><img alt="Upravit" src="<c:url value="/resources/images/edit.png" />" 
										height="18" onclick="edit()" /></a>
								</c:if>
							</c:if>
						</td>
						<td>
							&nbsp;&nbsp;
							<a href="<c:url value="/band/exportToPdf" />" target="_BLANK">
								<img alt="Prohlížet" src="<c:url value="/resources/images/pdf.png" />" height="32" />
							</a>
						</td>
					</tr>
				</table>
				</form:form>

				</div>
				
				<table width="100%">
					<tr>
						<th></th>
						<th>Název</th>
						<th>Popis</th>
						<th>Email</th>
						<th></th>
					</tr>
					<c:forEach items="${bands}" var="row" varStatus="stat">
					<tr class="${stat.index % 2 == 0 ? 'odd' : 'even'}" id="row${stat.index}">
						<td>${stat.index + 1}.</td>
						<td><c:out value="${row.name}"/></td>
						<td><c:out value="${row.description}"/></td>
						<td><c:out value="${row.email}"/></td>
						<td valign="top">
							<a href="<c:url value="/band/browse?id=${row.id}" />">
								<img alt="Prohlížet" src="<c:url value="/resources/images/browse.png" />" height="18" /></a>
							<c:if test="${not empty user}">
							|
							<a href="<c:url value="/band/edit?id=${row.id}" />">
								<img alt="Upravit" src="<c:url value="/resources/images/edit.png" />" height="18" /></a>
							|
							<a href="<c:url value="/band/delete?id=${row.id}" />" onclick="return deleteRow(${stat.index});">
								<img alt="Smazat" src="<c:url value="/resources/images/delete.png" />" height="18" /></a>
							</c:if>
						</td>
					</tr>
				</c:forEach>
				</table>
				
			</div>
			
			<br />
			<%@ include file="../snipped/footer.jsp"%>
		</div>
	</body>
	
</html>